package com.share.config;

import org.apache.log4j.Logger;
import org.springframework.ui.ModelMap;
import org.springframework.web.servlet.HandlerInterceptor;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * 拦截器的调用
 * 主要是导入静态资源的调用的拦截器
 * Created by er on 2017/9/30.
 */
public class FileImportInterceptor implements HandlerInterceptor {
    private final Logger logger = Logger.getLogger(this.getClass());

    @Override
    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
        return true;
    }


    @Override
    public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) throws Exception {
        /*String postUrl = request.getRequestURL().toString();
        if (modelAndView == null) {
            modelAndView = new ModelAndView();
        }
        ModelMap modelMap = modelAndView.getModelMap();
        modelMap.put("layui_css", "/css/common/layui.css");
        modelMap.put("comm_jquery", "/webjars/jquery/2.1.4/jquery.min.js");
        modelMap.put("layui_comm_js", "/js/common/layui.js");
        logger.info("请求地址为" + postUrl);*/

    }

    @Override
    public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception {

    }
}
